<div id="tabs_div"></div>
<div id="tab1">Hi!</div>
<div id="tab2">Hey!</div>

<script type="text/javascript">

  <?php
    
    echo $tabset->getVarName().' = '.$tabset->initialize(false);
  ?>

  function onLoadTab()
  {
  <?php $selectedTab = $tabset->getSelectedTab();  ?>
  <?php echo $selectedTab->getTabContentContainer(true) ?>.innerHTML = 'selected tabName: '+<?php echo $selectedTab->getTabName(true); ?>+' selected index:'+<?php echo $selectedTab->getTabIndex(true) ?>+' selected name container:'+<?php echo $selectedTab->getTabNameContainer(true) ?>+' selected callback:'+<?php echo $selectedTab->getTabCallback(true) ?>+' selected content container:'+<?php echo $selectedTab->getTabContentContainer(true) ?>;
  }

  function init()
  {
	<?php
	$tab1 = new GadgetsTab("tab1");
    $tab1->setTooltip('My tab1');
  	$tab1->setContentContainer(null);
    $tab1->setCallback(new JSFunction('onLoadTab')); 
    echo $tabset->addTab($tab1);
    
    
	$tab2 = new GadgetsTab("tab2");
    $tab2->setTooltip('My tab2');
  	$tab2->setContentContainer(null);
    $tab2->setCallback(new JSFunction('onLoadTab')); 
    echo $tabset->addTab($tab2);
	?>
	
  }
  <?php echo GadgetsUtil::registerOnLoadHandler(new JSFunction('init')); ?>
</script>